package com.feidee.data.report.util.quartz;

import java.util.UUID;

import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;

public abstract class BaseQuartzJob implements Job {

	private String groupName = UUID.randomUUID().toString().replaceAll("-", "");
	private String jobName = UUID.randomUUID().toString().replaceAll("-", "");
	private String cronExpressStr = "0 30 19 ? * 6L 2016-2019"; // 默认为2016年至2019年的每月的最后一个星期五19:30触发一次事件
	
	public BaseQuartzJob() {
	}
	
	public BaseQuartzJob(String cronExpressStr) {
		this.cronExpressStr = cronExpressStr;
	}

	abstract public void doJob(JobExecutionContext context);

	@Override
	public void execute(JobExecutionContext context) throws JobExecutionException {
		doJob(context);
	}

	public String getGroupName() {
		return groupName;
	}

	public void setGroupName(String groupName) {
		this.groupName = groupName;
	}

	public String getJobName() {
		return jobName;
	}

	public void setJobName(String jobName) {
		this.jobName = jobName;
	}

	public String getCronExpressStr() {
		return cronExpressStr;
	}

	public void setCronExpressStr(String cronExpressStr) {
		this.cronExpressStr = cronExpressStr;
	}

}
